package com.realtyManage.springboot.Service.impl;

import com.realtyManage.springboot.Dao.AgreementRepository;
import com.realtyManage.springboot.Model.Do.Agreement;
import com.realtyManage.springboot.Service.IAgreementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

/**
 * AgreementServiceImpl
 *
 * @Author 杭州素色网络科技有限公司
 * @Date 2019/4/9
 **/
@Service
@Transactional
public class AgreementServiceImpl implements IAgreementService {
    @Autowired
    private AgreementRepository agreementRepository;

    @Override
    public Agreement getOne(Integer id) {
        return agreementRepository.getOne(id);
    }

    @Override
    public boolean updateContent(Agreement entity) {
        Agreement agreement = agreementRepository.getOne(entity.getId());
        if(agreement != null){
            agreement.setContent1(entity.getContent1());
            agreement.setContent2(entity.getContent2());
            agreement.setContent3(entity.getContent3());
            agreement.setContent4(entity.getContent4());
            agreementRepository.save(agreement);
            return true;
        }else{
            return false;
        }
    }
}
